package hmvc.j2me.controller;

/*
 * Copyright 2008 Jens Meiss
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import hmvc.j2me.IInitializeAble;
import hmvc.j2me.ITerminateAble;
import hmvc.j2me.events.IEvent;
import hmvc.j2me.events.IEventListener;

/**
 * This Interface defines the Controller-Part of this MVC-Implementation
 *
 * @author   jens.meiss
 */
public interface IController extends ITerminateAble, IEventListener, IInitializeAble {

	/**
	 * adds an Controller-Only-Child-Component
	 */
	public void addChildController(IController controller);
	
	/**
	 * fires the event Down
	 */
	public void fireEventDown(IEvent event);
	
	/**
	 * 
	 * @param event
	 * @param up
	 * @param local
	 * @param down
	 */
	public void fireEvent(IEvent event, boolean up, boolean local, boolean down);
	
	/**
	 * fires the event Up
	 */
	public void fireEventUp(IEvent event);

	/**
	 * registers an EventListener for Events with the given Class
	 * 
	 * @param classOfEvent
	 * @param listener
	 */
	public void register(Class classOfEvent);
	
	public void addTerminatedChildController(IController controller);
	
	public void setControllerParent(IController controller);
	
	public boolean containsChildController(Class classOfController);

}
